package com.wy._10functionUnit;

import org.junit.Test;

import java.util.HashMap;
import java.util.List;

public class test {
    public static void main(String[] args) {
        People people = new People();
        people.setAge("1");
        people.setName("111");
        people.setAdd(1);
        People p = new People();
        p.setAge("2");
        p.setName("2222");
        p.setAdd(2);
        boolean compare = ObjComparators.compare(people, p, People::getAdd);
        System.out.println(compare);
    }

    @Test
    public void test1() {
        People people = new People();
        people.setAdd(1);
        people.setName("1");
        people.setA('1');
        people.setAddress("8");
        People2 people2 = new People2();
        people2.setAnInt(1);
        people2.setN_name("1");
        people2.setB('1');
        people2.setAddress("8.00");
        HashMap<ObjCompareFunction<Object, People>, ObjCompareFunction<Object, People2>> peoplePeople2HashMap = new HashMap<>();
        peoplePeople2HashMap.put(People::getAdd, People2::getAnInt);
        peoplePeople2HashMap.put(People::getName, People2::getN_name);
        peoplePeople2HashMap.put(People::getA, People2::getB);
        peoplePeople2HashMap.put(People::getAddress, People2::getAddress);
        CompareRes compare = ObjComparators.compare(people, people2, peoplePeople2HashMap);
        if (!compare.isaBoolean()) {
            List<String> diffs = compare.getDiffs();
            System.out.println(diffs);
        }
    }
}
